﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace MyFloridaHouse.libSvCommonUtilities.Converters
{
    /// <summary>   
    /// An inverted type converter for visibility and boolean values.   
    /// </summary>     
    /// public class ConvertNotBoolToVisibility : IValueConverter 
    public class ConvertNotBoolToVisibility : IValueConverter
    {
        public object Convert(
            object value,
            Type targetType,
            object parameter,
            CultureInfo culture)
        {
            bool visibility = !(bool)value;
            return visibility ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(
            object value,
            Type targetType,
            object parameter,
            CultureInfo culture)
        {
            Visibility visibility = (Visibility)value;
            return (visibility != Visibility.Visible);
        }
    }
}
